package ferp.android.widgets.buttons.rank;

import android.content.Context;
import android.util.AttributeSet;
import ferp.android.widgets.buttons.BidShifter;
import ferp.android.widgets.buttons.TextButton;
import ferp.core.game.Bid;
import ferp.core.game.Game;

/**
 * User: igorgok
 * Date: 12/30/13 12:25 PM
 */
public abstract class RankButton extends TextButton implements BidShifter
{
  public RankButton(Context context) {super(context);}
  public RankButton(Context context, AttributeSet attrs) {super(context, attrs);}
  public RankButton(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);}

  public final void set(Game g, Bid bid)
  {
    setEnabled(getEnabledState(g, bid));

    set(getText(bid));
  }

  protected abstract boolean getEnabledState(Game g, Bid bid);
  protected abstract String getText(Bid bid);
}
